<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改参数设置')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-config-edit" th:object="${config}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">提现百分比：</label>
                <div class="col-sm-4">
                    <input name="handFee" th:field="*{handFee}"  type="text" required>%
                </div>
                <label class="col-sm-2 control-label is-required">usdt换余额：</label>
                <div class="col-sm-4">
                    1:<input name="usdtToRmb" th:field="*{usdtToRmb}"  type="text" required>
                </div>
            </div>
            <div class="form-group">

            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">推荐奖：</label>
                <div class="col-sm-4">
                    <textarea style="width: 100%" name="reAward" type="text" required>[[${config.reAward}]]</textarea>
                </div>
                <label class="col-sm-2 control-label is-required">团队奖：</label>
                <div class="col-sm-4">
                    <textarea style="width: 100%"  name="teamAward" type="text" required>[[${config.teamAward}]]</textarea>

                </div>
            </div>
            <div class="form-group" style="text-align: center;color: red">
                默认单位为百分比，不需要写百分比，奖金参数设置格式：1代25，2代6.25，3代1.5625
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">转账提现开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'transferSwitch_' + dict.dictCode}" name="transferSwitch" th:value="${dict.dictValue}" th:field="*{transferSwitch}" required>
                        <label th:for="${'transferSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
                <label class="col-sm-2 control-label">充值开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'rechargeSwitch_' + dict.dictCode}" name="rechargeSwitch" th:value="${dict.dictValue}" th:field="*{rechargeSwitch}" required>
                        <label th:for="${'rechargeSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    

            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">支付宝提现开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'wAlipaySwitch_' + dict.dictCode}" name="wAlipaySwitch" th:value="${dict.dictValue}" th:field="*{wAlipaySwitch}" required>
                        <label th:for="${'wAlipaySwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
                <label class="col-sm-2 control-label">微信提现开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'wWechatSwitch_' + dict.dictCode}" name="wWechatSwitch" th:value="${dict.dictValue}" th:field="*{wWechatSwitch}" required>
                        <label th:for="${'wWechatSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    

            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">udst提现开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'wUsdtSwitch_' + dict.dictCode}" name="wUsdtSwitch" th:value="${dict.dictValue}" th:field="*{wUsdtSwitch}" required>
                        <label th:for="${'wUsdtSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
                <label class="col-sm-2 control-label">银行卡提现开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'wBankSwitch_' + dict.dictCode}" name="wBankSwitch" th:value="${dict.dictValue}" th:field="*{wBankSwitch}" required>
                        <label th:for="${'wBankSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    

            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">登录开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'loginSwitch_' + dict.dictCode}" name="loginSwitch" th:value="${dict.dictValue}" th:field="*{loginSwitch}" required>
                        <label th:for="${'loginSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
                <label class="col-sm-2 control-label">注册开关：</label>
                <div class="col-sm-4">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_switch_state')}">
                        <input type="radio" th:id="${'registerSwitch_' + dict.dictCode}" name="registerSwitch" th:value="${dict.dictValue}" th:field="*{registerSwitch}" required>
                        <label th:for="${'registerSwitch_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    

            </div>

            <div class="form-group">    

            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">微信收款码：</label>
                <div class="col-sm-4">
                    <input type="hidden" name="wechatCode" th:field="*{wechatCode}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="wechatCode" name="file" type="file">
                    </div>
                </div>
                <label class="col-sm-2 control-label is-required">支付宝收款码：</label>
                <div class="col-sm-4">
                    <input type="hidden" name="alipayCode" th:field="*{alipayCode}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="alipayCode" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    

            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">公司usdt：</label>
                <div class="col-sm-4">
                    <input name="usdt" th:field="*{usdt}" class="form-control" type="text" required>
                </div>
                <label class="col-sm-2 control-label is-required">银行卡：</label>
                <div class="col-sm-4">
                    <input name="bankCard" th:field="*{bankCard}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">开户姓名：</label>
                <div class="col-sm-4">
                    <input name="accountName" th:field="*{accountName}" class="form-control" type="text" required>
                </div>
                <label class="col-sm-2 control-label is-required">开户银行：</label>
                <div class="col-sm-4">
                    <input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12 col-sm-offset-6">
                    <button type="button" onclick="submitHandler()" class="btn btn-primary">提交</button>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "config/config";
        $("#form-config-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
            }
        }

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx+ 'common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>